/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cs425proj.model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;

/**
 *
 * @author prateekpatil
 */
public class disDetail {
    
    private int discussion_id;
    private int member_id;
    private String content;
    private int movie_id;
    private int theater_id;
    private String title;
    private int visits;
    
    
    public ArrayList<String> getRecentDisscusion()
    {
        ResultSet rs;
        ArrayList <String> list = new ArrayList<String>();
        try{
        connectDB obj = new connectDB();
        
        Statement stm;
        stm =  obj.startConnection().createStatement();
        //Querries
        rs = stm.executeQuery("select * from (select * from discussion order by discussion_id desc) where rownum <=10");
        while(rs.next()){
            this.setDiscussion_id(rs.getInt(1));
            this.setMember_id(rs.getInt(2));
            this.setContent(rs.getString(3));
            this.setMovie_id(rs.getInt(4));
            this.setTheater_id(rs.getInt(5));
            this.setTitle(rs.getString(6));
            this.setVisits(rs.getInt(7));
            list.add(this.getDiscussion_id()+";"+this.getTitle());
        }
        obj.closeConnection();
                
        }catch(SQLException e){e.printStackTrace();}
       return list; 
    }
    

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getDiscussion_id() {
        return discussion_id;
    }

    public void setDiscussion_id(int discussion_id) {
        this.discussion_id = discussion_id;
    }

    public int getMember_id() {
        return member_id;
    }

    public void setMember_id(int member_id) {
        this.member_id = member_id;
    }

    public int getMovie_id() {
        return movie_id;
    }

    public void setMovie_id(int movie_id) {
        this.movie_id = movie_id;
    }

    public int getTheater_id() {
        return theater_id;
    }

    public void setTheater_id(int theater_id) {
        this.theater_id = theater_id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getVisits() {
        return visits;
    }

    public void setVisits(int visits) {
        this.visits = visits;
    }
    
    

    
}
